﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Scoot.UI
{
    /// <summary>
    /// Interaction logic for ContactTile.xaml
    /// </summary>
    public partial class ContactTile : UserControl
    {
        public delegate void ContactTileEventHandler(ContactTile sender);
        public event ContactTileEventHandler Double_Click;



        public int uin;
        public ContactTile(string showName, int uin)
        {
            InitializeComponent();
            this.UserName.Text = showName;
            this.uin = uin;
        }

        private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Double_Click(this);
        }
        public void changeState(ggdll.GGContacts.GGContactState state)
        {
            switch (state.status & 0x00FF)
            {
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_AVAIL:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_AVAIL_DESCR:
                    ContactStatus.Source = Statics.IconAvaible;
                    break;
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_BUSY:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_BUSY_DESCR:
                    ContactStatus.Source = Statics.IconAway;
                    break;
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_DND:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_DND_DESCR:
                    ContactStatus.Source = Statics.IconDND;
                    break;
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_FFC:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_FFC_DESCR:
                    ContactStatus.Source = Statics.IconFFC;
                    break;
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_INVISIBLE:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_INVISIBLE_DESCR:
                    ContactStatus.Source = Statics.IconInvisible;
                    break;
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_NOT_AVAIL:
                case (int)ggdll.GGContacts.GGContactStatusEnum.GG_STATUS_NOT_AVAIL_DESCR:
                    ContactStatus.Source = Statics.IconUnavaible;
                    break;
            };
            UserDescription.Text = state.description;
        }



        private void HideDescr_Click(object sender, RoutedEventArgs e)
        {
            this.UserDescription.Visibility = System.Windows.Visibility.Collapsed;
        }
    }
}
